﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Control.Bus;

namespace QuanLyKho
{
    public partial class FrmLogin : Form
    {
        public FrmLogin()
        {
            InitializeComponent();
        }
        private BusStaff staff;
        public BusStaff Staff
        {
            set { staff = value; }
            get 
            {
                if (staff == null)
                    staff = new BusStaff();
                return staff;
            }
        }
        private void btDangNhap_Click(object sender, EventArgs e)
        {
            string username = textBox1.Text;
            string password = textBox2.Text;
            BusStaff nv = new BusStaff()
            {
                ID = -1,
                UserName = username,
                PassWord = password
            };
            bool resuilt = nv.DangNhap();
            if (resuilt == false)
                lbThongBao.Text = "Đăng Nhập Thất Bại!!!";
            else
            {
                Staff = nv;
                this.Close();
            }
        }
    }
}
